VERSION 5.00 Begin VB.Form Form1 Caption = "Form1" ClientHeight = 4095 ClientLeft = 60 ClientTop = 345 ClientWidth = 8400 LinkTopic = "Form1" ScaleHeight = 4095 ScaleWidth = 8400 StartUpPosition = 3 'Windows Default Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub Form_Load() WriteHTMLListing "C:\", "*.*", "c:\nr1.htm", "HTML List Generator", "Files in c:\" End Sub Sub WriteHTMLListing(Directory As String, FileExtension As String, ListFilename As String, Appname As String, ListTitle As String) 'Note - when outputting HTML, make sure you replace any " marks with Chr(34) or the tags will be ignored Dim CurrFile As String 'Used to hold the filenames Dim FF, FileCount As Integer 'FF - Used to hold Freefile number, FileCount - Used for footer info FF = FreeFile 'You should know what this means CurrFile = Dir(Directory & FileExtension) 'Change the DIR directory to Directory Variable 'and show all files of FileExtension (wildcards included) Open ListFilename For Output As #FF 'Open the output file Print #FF, "" & vbCrLf & "" & vbCrLf & "" _ & vbCrLf & "" & ListTitle _ & "" & vbCrLf & "

" _ & ListTitle & "

 

" Do While CurrFile <> "" 'Do until the DIR function returns a null string, indicating no more files Print #FF, "

" & CurrFile & "

" 'Put the filename of the current file in the open file FileCount = FileCount + 1 'Increment File counter (for footer so U can remove it if U want) CurrFile = Dir() 'Print a blank line to seperate the list and the footer, then print 'the footer. The footer here is the number of files in the directory. Print #FF, "

 

" & FileCount & " Files" & "" Close #FF 'Close the output file End Sub